package tuanda.soict.firstsun.DataPackage;

/**
 * @author tuanda_soict_hut
 * @version 0.0.1
 * @since 25-8-2012
 */
public enum BuildingDataSet implements CommonConstants {

	TOWN(0, "TOWN", 5, 0, LAND_TYPE, 0, 20, NOT_SUPPORTED, PRODUCE_GOLD_TYPE),
	CITY(1, "CITY", 10, 1, LAND_TYPE, 50, 20, NOT_SUPPORTED, RESTORE_HP_TYPE),
	HABOUR(2, "HABOUR", 10, 1, LAND_TYPE + SEA_TYPE, 40, 20, SEA_TYPE,PRODUCE_ARMY_TYPE),
	CASTLE(3, "CASTLE", 15, 1, LAND_TYPE, 30, 20,LAND_TYPE, PRODUCE_ARMY_TYPE),
	CAPITOL(4, "CAPITOL", 15, 2,LAND_TYPE, 100, 20, NOT_SUPPORTED, HEAD_QUARTER_TYPE);
	private final int ID;
	private final String name;
	private final int defense;
	private final int type;
	private int obstaclePoint;
	private int hpRestore;
	private int goldProduce;
	private int armyProduceType;
	private int category;

	private BuildingDataSet(int id, String nam, int def, int obsPoint, int typ,
			int goldProd, int hp, int armyProduce, int cat) {
		ID = id;
		name = nam;
		defense = def;
		obstaclePoint = obsPoint;
		type = typ;
		goldProduce = goldProd;
		hpRestore = hp;
		armyProduceType = armyProduce;
		category = cat;
	}

	public final int getID() {
		return this.ID;
	}

	public final int getDataID() {
		return this.ID % MAX_NUMBER_UNIT;
	}

	public final String getName() {
		return this.name;
	}

	public final int getDefense() {
		return this.defense;
	}

	public final int getObstaclePoint() {
		return this.obstaclePoint;
	}

	public int getType() {
		return this.type;
	}

	public final int getGoldProduce() {
		return this.goldProduce;
	}

	public final int getHPRestore() {
		return this.hpRestore;
	}

	public final int getArmyProduceType() {
		return this.armyProduceType;
	}

	public final int getCategory() {
		return this.category;
	}

	public final BuildingDataSet getBuildingData(int id) {
		for (BuildingDataSet build : BuildingDataSet.values()) {
			if (build.getID() == id) {
				return build;
			}
		}
		return BuildingDataSet.TOWN;
	}
}
